#ifndef __HardwareProfile_h__
#define __HardwareProfile_h__

//#define Proteus

//#define NoScreen
#define CallTestFunction

#define Test_4M

#include <htc.h>
#define _XTAL_FREQ 4000000
#include "FlagDefine.h"
#define WFRomOperation
#include "afx.h"
#include "TypeDefine.h"
#include "Verify.h"

#include "PhoneNums.h"

#define T1CYCLE_4M 15536 //100ms
//#define T1CYCLE_31K 7411 //15s
#define D32ms_31K 155

#define ONEWIRE_PIN_DIR	TRISB1
#define ONEWIRE_PIN_W 	LATB1
#define ONEWIRE_PIN_R 	RB1
#define OneWire_ReadDelayOffSet 7
#include "OneWire.h"
#include "DS18x20.h"

#include "Display.h"

#define POWER_ON_W LATD5
#define STATUS_R RD4
#define Key_R RB2
#define KeyTest_R RB3

//#define ATCommand_ResetWait() TMR2ON=0;TMR2=0;TMR2ON=1
#define Uart_Uart1
#define Uart_TRMT TRMT
#define Uart_TXREG TXREG
#include "Uart.h"
#define ATCommand_MaxRX 200
#include "ATCommand.h"

#define CallTimeOut 200

unsigned int SystemTick;
unsigned int NoCallPeriod;
unsigned int NoCalls; 
unsigned char CSQ;
uint OldTemp;
uint CurTemp;
_GFlags gFlags;
//unsigned char gTest;
unsigned char ErrState;
//unsigned long NeedSendSMS;
unsigned char CallDatas[50];
enum {NoErr=0,MissT,Miss900a,MissAT,MissSimCard,MissNet,ErrMSG,ErrCSQ,
	ErrNoticeCall,ErrIntCall,ErrDemicalCall
	,MissAT_CPMS,MissAT_CMGR,MissAT_CMGDA,MissAT_ATH0,MissAT_ATE1,MissAT_CNMI
	,MissAT_CMGF,MissAT_CSQ,MissAT_COPS,MissAT_COLP,MissAT_CLCC,MissPower};
void InitSystem( void );
void BigDelay(unsigned int x);
void CallSend(void);
void CallTestSend(void);
unsigned char PowerON(void);
unsigned char PowerDown(void);
void CallProc(void);
void CallTestProc(void);
#endif
